/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package atualizacoes;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Douglas
 */
@Entity
@Table(name = "rotinas", catalog = "", schema = "")
@NamedQueries({
    @NamedQuery(name = "Rotinas.findAll", query = "SELECT r FROM Rotinas r"),
    @NamedQuery(name = "Rotinas.findByCodRotina", query = "SELECT r FROM Rotinas r WHERE r.codRotina = :codRotina"),
    @NamedQuery(name = "Rotinas.findByRotina", query = "SELECT r FROM Rotinas r WHERE r.rotina = :rotina"),
    @NamedQuery(name = "Rotinas.findByNomeInterno", query = "SELECT r FROM Rotinas r WHERE r.nomeInterno = :nomeInterno")})
public class Rotinas implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "cod_rotina")
    private Integer codRotina;
    @Basic(optional = false)
    @Column(name = "rotina")
    private String rotina;
    @Basic(optional = false)
    @Column(name = "nome_interno")
    private String nomeInterno;
    @OneToMany(mappedBy = "codRotina")
    private List<Atualizacoes> atualizacoesList;
    @OneToMany(cascade = CascadeType.ALL,mappedBy = "codRotina")
    private List<Historicos> historicosList;

    public Rotinas() {
    }

    public Rotinas(Integer codRotina) {
        this.codRotina = codRotina;
    }

    public Rotinas(Integer codRotina, String rotina, String nomeInterno) {
        this.codRotina = codRotina;
        this.rotina = rotina;
        this.nomeInterno = nomeInterno;
    }

    public Integer getCodRotina() {
        return codRotina;
    }

    public void setCodRotina(Integer codRotina) {
        Integer oldCodRotina = this.codRotina;
        this.codRotina = codRotina;
        changeSupport.firePropertyChange("codRotina", oldCodRotina, codRotina);
    }

    public String getRotina() {
        return rotina;
    }

    public void setRotina(String rotina) {
        String oldRotina = this.rotina;
        this.rotina = rotina;
        changeSupport.firePropertyChange("rotina", oldRotina, rotina);
    }

    public String getNomeInterno() {
        return nomeInterno;
    }

    public void setNomeInterno(String nomeInterno) {
        String oldNomeInterno = this.nomeInterno;
        this.nomeInterno = nomeInterno;
        changeSupport.firePropertyChange("nomeInterno", oldNomeInterno, nomeInterno);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codRotina != null ? codRotina.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rotinas)) {
            return false;
        }
        Rotinas other = (Rotinas) object;
        if ((this.codRotina == null && other.codRotina != null) || (this.codRotina != null && !this.codRotina.equals(other.codRotina))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "atualizacoes.Rotinas[ codRotina=" + codRotina + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
